/****** Object:  Table [dbo].[ticketDetail]    ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[ticketDetail](
	[ticketDetailId] [int] IDENTITY(1,1) NOT NULL,
	[bookingId] [int] NOT NULL,
	[flightScheduleId] [int] NULL,
	[passengerId] [int] NULL,
	[seatNo] [nchar](10) NULL,
	[seatTypeCode] [nchar](10) NULL,
	[ticketFare] [float] NULL,
 CONSTRAINT [PK_ticketDetail] PRIMARY KEY CLUSTERED 
(
	[ticketDetailId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[ticketDetail]  WITH CHECK ADD  CONSTRAINT [FK_ticketDetail_booking] FOREIGN KEY([bookingId])
REFERENCES [dbo].[booking] ([bookingId])
GO

ALTER TABLE [dbo].[ticketDetail] CHECK CONSTRAINT [FK_ticketDetail_booking]
GO

ALTER TABLE [dbo].[ticketDetail]  WITH CHECK ADD  CONSTRAINT [FK_ticketDetail_flightSchedule] FOREIGN KEY([flightScheduleId])
REFERENCES [dbo].[flightSchedule] ([flightScheduleId])
GO

ALTER TABLE [dbo].[ticketDetail] CHECK CONSTRAINT [FK_ticketDetail_flightSchedule]
GO

ALTER TABLE [dbo].[ticketDetail]  WITH CHECK ADD  CONSTRAINT [FK_ticketDetail_passenger] FOREIGN KEY([passengerId])
REFERENCES [dbo].[passenger] ([passengerId])
GO

ALTER TABLE [dbo].[ticketDetail] CHECK CONSTRAINT [FK_ticketDetail_passenger]
GO

ALTER TABLE [dbo].[ticketDetail]  WITH CHECK ADD  CONSTRAINT [FK_ticketDetail_seatType] FOREIGN KEY([seatTypeCode])
REFERENCES [dbo].[seatType] ([seatTypeCode])
GO

ALTER TABLE [dbo].[ticketDetail] CHECK CONSTRAINT [FK_ticketDetail_seatType]
GO

